<template>
	<view>
		<uni-popup ref="popup" type="center">
			<view class="pub-inner">
				<!-- <image src="https://admin.huodongtg.com/static/image/wxpub-bg.png" mode="heightFix" class="wxpub-bg"></image> 
				<image src="https://admin.huodongtg.com/static/image/wxpub-title.png" mode="heightFix" class="wxpub-title"></image>
				<image src="https://admin.huodongtg.com/static/image/wxpub-tipbg.png" mode="heightFix" class="wxpub-tipbg"></image> -->
				<image src="https://admin.huodongtg.com/static/image/bg-wx-gzh.png"  mode="heightFix"  class="wxpub-full-bg"></image>
				<view class="flex item-center flex-col code-box">
					<view class="wxpub-msg">随时接收活动，订单信息</view>
					<image :src="userStore.wxPubInfo.wxPubCodeUrl" mode="heightFix" :show-menu-by-longpress="true" class="code-img"></image>
					<view class="wxpub-tip">长按识别，立即关注公众号</view>
				</view>
			</view>
			<view class="w-full mb-10 flex item-center justify-center">
				<image src="@/static/svg/icon-close.svg" mode="widthFix" class="icon-close"
					style="width: 32px;" @click="showPop(false)"></image>
			</view>
		</uni-popup>
		
	</view>
</template>

<script setup>
	// https://admin.huodongtg.com/static/image/
	import {
		ref
	} from 'vue'
	import {
		useUserStore
	} from '@/stores/modules/user.js'
	const userStore = useUserStore()
	const popup = ref()
	const showPop = (value) => {
		console.log(value,popup.value)
		if (value) {
			popup.value && popup.value.open('center')
		} else {
			userStore.getWxRead()
			popup.value && popup.value.close()
		}
	}
	defineExpose({
		showPop
	})
</script>

<style scoped lang="scss">
	.pub-inner{
		position: relative;
		margin-top: 120rpx;
		.wxpub-bg{
			height: 650rpx;
			position: relative;
			z-index: 1;
		}
		.wxpub-full-bg{
			height: 750rpx;
			position: relative;
			z-index: 1;
			top: -130rpx;
		}
		.wxpub-title{
			height: 150rpx;
			position: absolute;
			top: -55rpx;
			left: 0;
			z-index: 2;
		}
		.wxpub-tipbg{
			height: 252rpx;
			position: absolute;
			top: -185rpx;
			right: -21rpx;
		}
		.code-box{
			position: absolute;
			width: 100%;
			top: 130rpx;
			left: 0;
			z-index: 2;
		}
		.wxpub-msg{
			color: rgba(113, 57, 17, 1);
			font-size: 28rpx;
			font-weight: bold;
			margin-bottom: 20rpx;
		}
		.wxpub-tip{
			color: rgba(250, 69, 67, 1);
			font-size: 24rpx;
			margin-top: 26rpx;
		}
		.code-img{
			border-radius: 8px;
			height: 360rpx;
			box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.15);
			// padding: 20rpx;
			background-color: #ffffff;
		}
	}
	.icon-close{
		margin-top: 40rpx;
	}
</style>